package com.dealin.dealinlibs.tool;

/**
 * Created by lenovo on 2016/7/26.
 */
public class EncryptTool
{
    public EncryptTool()
    {

    }
    public static String encryptByChar(String str) {
        char[] a = str.toCharArray();
        for (int i = 0; i < a.length; i++)
        {
            a[i] = (char) (a[i] - 'l');
        }
        String s = new String(a);
        return s;
    }
    public static String decryptByChar(String str)
    {
        char[] a = str.toCharArray();
        for (int i = 0; i < a.length; i++)
        {
            a[i] = (char) (a[i] + 'l');
        }
        String s = new String(a);
        return s;
    }
    public static String encryptByByte(String str)
    {
        byte[] b=str.getBytes();
        for(int i=0;i<b.length;i++)
        {
            b[i]=(byte)(b[i]-1);
        }
        return new String(b);
    }
    public static String decryptByByte(String str)
    {
        byte[] b=str.getBytes();
        for(int i=0;i<b.length;i++)
        {
            b[i]=(byte)(b[i]+1);
        }
        return new String(b);
    }

}
